#!/usr/local/python/bin/python
# coding=utf-8
__author__ = 'Junjie.M'


class LocalUtil(object):
    # 删除文件
    @staticmethod
    def getRmoveFileShell(filePath):
        shell = 'rm -f ' + filePath
        print shell
        return shell

    # 新建空文件
    @staticmethod
    def getTouchFileShell(filePath):
        shell = 'touch ' + filePath
        print shell
        return shell

    # 授权
    @staticmethod
    def getChmodShell(option, path):
        shell = 'chmod ' + option + ' ' + path
        print shell
        return shell

    # 授权
    @staticmethod
    def getChownShell(user, group, path):
        shell = 'chown ' + user + ':' + group + ' ' + path
        print shell
        return shell

    # 输出内容到文本
    @staticmethod
    def getEchoToFileShell(context, flgPath):
        shell = 'echo "' + context + '" > ' + flgPath
        print shell
        return shell

    # 创建目录
    @staticmethod
    def getMkdirShell(dirPath):
        shell = 'mkdir -p ' + dirPath
        print shell
        return shell

    # 移动文件
    @staticmethod
    def getMoveFileShell(localfile, finalfile):
        shell = 'mv ' + localfile + ' ' + finalfile
        print shell
        return shell

    # 文件转换编码
    @staticmethod
    def getIconvShell(sourceEncode, destEncode, sourceFilePath, destFilePath):
        shell = 'iconv -c -f ' + sourceEncode + ' -t ' + destEncode + ' ' + sourceFilePath + ' > ' + destFilePath
        print shell
        return shell

    # 解压缩Zip包
    @staticmethod
    def getGunzipShell(zipFile, tmpFile):
        shell = 'gunzip -c ' + zipFile + ' > ' + tmpFile
        print shell
        return shell

    # 解压缩Zip包
    @staticmethod
    def getGunzipShell2(zipFile):
        shell = 'gunzip ' + zipFile
        print shell
        return shell